<!--
  停车场区域表编辑页面
  User: YanZengBao
  Date: 2020-02-19
-->
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<!-- BEGIN FORM-->
<div class="portlet light">
    <div class="portlet-title">
        <div class="caption">
            <span class="caption-subject font-red-sunglo bold uppercase">停车场区域表编辑</span>
            <span class="caption-helper">编辑一条停车场区域表数据</span>
        </div>
    </div>
    <div class="portlet-body form">
        <!-- BEGIN FORM-->
        <form action="#" class="form-horizontal" id="edit-module">
            <div class="form-body">

                <!--  字段信息-->
                <div class="form-group hide">
                    <label class="col-md-3 control-label"></label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <input type="text" disabled class="form-control" required name="id"
                                       th:value="${data['id']}" placeholder="">
                            </div>
                        </div>
                    </div>
                </div>

                <!--  字段信息-->
                <div class="form-group">
                    <label class="col-md-3 control-label">车场名称</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <input type="text" class="form-control" readonly required minlength="2" name="parkName"
                                       th:value="${data['parkName']}" placeholder="">
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 区域名称 字段信息-->
                <div class="form-group">
                    <label class="col-md-3 control-label">区域名称</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <input type="text" class="form-control" maxlength="100" required minlength="2"
                                       name="name" th:value="${data['name']}" placeholder="区域名称">
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 区域编号 字段信息-->
                <div class="form-group">
                    <label class="col-md-3 control-label">区域编号</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <input type="text" class="form-control" maxlength="50" required minlength="2" name="number"
                                       th:value="${data['number']}" placeholder="区域编号">
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 预留字段 字段信息-->
                <!--              <div class="form-group">
                                  <label class="col-md-3 control-label">预留字段</label>
                                  <div class="col-md-4">
                                      <div class="input-inline ">
                                          <div class="input-group">
                                              <span class="input-group-addon">
                                                  <i class="fa fa-edit"></i>
                                              </span>
                                              <input type="number" class="form-control" required  name="areaType" th:value="${data['areaType']}" placeholder="预留字段">
                                          </div>
                                      </div>
                                  </div>
                              </div>-->

                <!-- 添加时间 字段信息-->
                <div class="form-group">
                    <label class="col-md-3 control-label">添加时间</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <input type="text" class="form-control" readonly
                                       th:value="${#dates.format(data['createTime'],'yyyy-MM-dd HH:mm:ss')}"
                                       placeholder="添加时间">
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 停车场ID 字段信息-->
                <div class="form-group hide">
                    <label class="col-md-3 control-label">停车场ID</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <input type="text" class="form-control" required minlength="2" name="parkId"
                                       th:value="${data['parkId']}" placeholder="停车场ID">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <div class="row">
                    <div class="col-md-6">
                        <div class="row">
                            <div class="col-md-offset-3 col-md-9">
                                <button type="button" class="btn green" onclick="edit();">保存</button>
                                <button type="button" class="btn default" onclick="layer.close(layer_editModule);">取消
                                </button>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6"></div>
                </div>
            </div>
        </form>
        <!-- END FORM-->
    </div>
</div>

<script>

    $(function () {
        //初始化页面
        initPage();
    });

    function edit() {
        let param = tools.formParams("edit-module");
        if (tools.valid("edit-module")) {
            tools.post("/parkArea/update", param, function (data) {
                if (data.success) {
                    layer.msg(data.message, {icon: 1, time: 2000}, function () {
                        //刷新列表页面
                        toPage(null);
                        //关闭弹窗
                        layer.close(layer_editModule);
                    });
                } else {
                    tools.errorTip(data.code,data.message);
                }
            });
        }
    }

</script>
</html>